package kr.saeildamil.androidforstudy2.ch21;

import kr.saeildamil.androidforstudy2.R;
import android.app.ActionBar;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.widget.Button;

public class OverlayShowHideActionBarTest extends Activity {
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch21_overlayshowhideactionbartest);
	}
	
	public void mOnClick(View v){
		switch (v.getId()) {
		case R.id.ch21_overlayshowhideactionbar_showhidebtn:
			ActionBar act = getActionBar();
			if(act.isShowing()){
				act.hide();
				((Button)v).setText("Show Action Bar");
			}else{
				act.show();
				((Button)v).setText("Hide Action Bar");
			}
			break;
		}
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.actionbarmenu, menu);
		return true;
	}

}
